package com.platform.common.util;

import org.apache.commons.lang.time.DateUtils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: wangyanginfo
 * Date: 12-9-13
 * Time: 下午8:21
 * To change this template use File | Settings | File Templates.
 */
public class DateUtil extends org.apache.commons.lang.time.DateUtils {

    public static final String YYYY_MM_DD = "yyyy-MM-dd";

    public static final String YYYY_MM_DD_24H_MM_SS = YYYY_MM_DD + " HH:mm:ss";

    public static final String YYYY_MM_DD_12H_MM_SS = YYYY_MM_DD + " hh:mm:ss";

    /**
     * 将当前日期传换为字符串
     *
     * @param format 格式化字符串
     * @return
     */
    public static String toDayString(String format) {
        DateFormat df = new SimpleDateFormat(format);
        return df.format(new Date());
    }
}
